const { Service } = require('egg');

class BeerRecordService extends Service {
  async list(params) {
    const results = await this.app.mysql.select('beer_record', {
      where: params,
    });

    return results;
  }

  async detail(where) {
    const results = await this.app.mysql.select('beer_record', {
      where,
    });

    return results?.[0] || null;
  }

  async add(data) {
    const results = await this.app.mysql.insert('beer_record', data);

    return results;
  }
}

module.exports = BeerRecordService;
